﻿'Imports SFML
Imports Microsoft.VisualBasic.MyServices
Public Class Missile
    Inherits Actor
    Dim Direction As Integer
    Shared ShootTimer As Timers.Timer
    Private Sub TimerStart()
        ShootTimer = New Timers.Timer(10)
        AddHandler ShootTimer.Elapsed, New Timers.ElapsedEventHandler(AddressOf TimerHandler)
        ShootTimer.Enabled = True
    End Sub
    Private Sub TimerHandler(ByVal sender As Object, ByVal e As Timers.ElapsedEventArgs)
        Act()
    End Sub
    Public Sub Shoot(ByVal direction As Integer, ByVal Position As SFML.Graphics.Vector2)
        Me.Direction = direction
        Me.Position = Position
        TimerStart()
        Act()
    End Sub
    Public Sub Act()
        Select Case Direction
            Case 0
                Move(0, -2)
                Me.Rotation = 0
            Case 180
                Move(0, +2)
                Me.Rotation = 180
            Case 90
                Move(-2, 0)
                Me.Rotation = 90
            Case 270
                Move(+2, 0)
                Me.Rotation = 270
        End Select
        'If Me.Position.X = Window.X then destroy() and stopTimer()
    End Sub
End Class